<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>项目阶段设置</title>
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--公用样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/comment.css">
    <!--页面样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/style.css">
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/extended.css">
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
</head>
<body class="whitebg">
<div class="myDataCentere mydataCentere-small addformstage" style="height: 500px!important;">
    <form  style="margin-left: 20px;">
        <div class="layui-inline">
            <label>
                <span class="red">*</span>阶段名称
            </label>
            <div >
                <input type="text" id="stageId" name="id"  value="${stagedto.id}" style="width: 500px !important;"  autocomplete="off" lay-verify="stageName"  >
                <input type="text" id="stageName" name="stageName" value="${stagedto.stageName}"  style="width: 500px !important;"  autocomplete="off" lay-verify="stageName"  >
            </div>
        </div>
        <div class="layui-inline">
            <label >
                <span class="red">*</span>开始时间
            </label>
            <div class="layui-input-inline">
                <input type="text" id="startDate" name="startDate"    style="width: 500px !important;"   autocomplete="off" lay-verify="startDate"  class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <label >
                <span class="red">*</span>结束时间
            </label>
            <div class="layui-input-inline">
                <input type="text" id="endDate" name="endDate"  style="width: 500px !important;"  autocomplete="off" lay-verify="endDate"   class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label >
                <span class="red">*</span>序号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="orderNum" name="orderNum"   style="width: 500px !important;"  value="${stagedto.orderNum}"  autocomplete="off" lay-verify="orderNum"   class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">

            <button  class="layui-btn layui-btn-primary" id="close">
                关闭
            </button>
            <button  class="layui-btn layui-btn-normal" lay-filter="add" lay-submit="">
                保存
            </button>

        </div>
    </form>
</div>


<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>


<script>
    var fbId = "${fbId}";
    var projectId = "${projectId}";
    layui.use(['form','layer','laydate'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer, laydate = layui.laydate;

        $('#close').click(function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
        laydate.render({
            elem: '#startDate'
            ,format: 'yyyy-MM-dd',
            trigger: 'click'
        });
        laydate.render({
            elem: '#endDate',
            format: 'yyyy-MM-dd',
            trigger: 'click'
        });
        //监听提交


        form.on('submit(add)', function(data){
            var stageId = $('#stageId').val();
            var stageName = $('#stageName').val();
            var orderNum = $('#orderNum').val();
            var startDate = $('#startDate').val();
            var endDate = $('#endDate').val();
            console.log(stageName,"阶段名称")
            console.log(orderNum,"序号")
            console.log(startDate,"开始时间")
            console.log(endDate,"结束时间")
            console.log(layer,"结束时间")
            if(!stageName){
                parent.layer.msg("请输入阶段名称!", {icon: 1});
                return ;
            }
            if(!orderNum){
                parent.layer.msg("请输入序号!",{icon:2});
                return ;
            }
            if(!startDate){
                parent.layer.msg("请输入开始时间!",{icon:2});
                return ;
            }
            if(!endDate){
                parent.layer.msg("请输入结束时间!",{icon:2});
                return ;
            }

            var json = {
                stageName: stageName,
                orderNum: orderNum,
                startDateStr: startDate,
                endDateStr: endDate,
                id:stageId
            }
            layerAjax('/project/projectManager/projectJd/updateJdStage',json, '',
                function (d) {
                    console.log(d);
                    if (d.flag == true) {
                        parent.layer.msg(d.msg, {icon: 1});
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
            return false;
        });
    });
</script>

</body>

<style>
    .addformstage{
        margin-left: 100px;
        height: 100%;
        background-color: white;


    }
    </style>





</html>
